﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace Model
{

    [MetadataType(typeof(Sys_Users_Metadata))]
    [DisplayName("系统用户")]
    public partial class Sys_Users
    {
        public Sys_Users()
        {
            this.Id = Guid.NewGuid();
            this.Global = false;
        }
        public class Sys_Users_Metadata
        {
            [ScaffoldColumn(false)]
            public Guid Id { get; set; }

            [DropDownList("Sys_Enterprise", "Id", "EnterpriseName")]
            [DisplayName("企业名称")]
            public Guid EnterpriseId { get; set; }

            [DisplayName("用户名")]
            [Required(ErrorMessage = "用户名不能为空")]
            public string UserName { get; set; }

            [DisplayName("密码")]
            [DataType(DataType.Password)]
            [Required(ErrorMessage = "密码不能为空")]
            public string Password { get; set; }

            [DisplayName("更新时间")]
            [Required(ErrorMessage = "更新时间不能为空")]
            public DateTime LastActivityDate { get; set; }

            [DisplayName("说明")]
            [DisplayFormat(ConvertEmptyStringToNull = false)]
            public string Description { get; set; }

            [DisplayName("IP地址")]
            [DisplayFormat(ConvertEmptyStringToNull = false)]
            public string IP { get; set; }

            [DisplayName("Email")]
            [DataType(DataType.EmailAddress)]
            [DisplayFormat(ConvertEmptyStringToNull = false)]
            public string Email { get; set; }

            [DisplayName("用户角色")]
            public object Sys_UsersInRoles { get; set; }

            [DropDownList("Sys_Theme", "Id", "DisplayName")]
            [DisplayName("用户主题")]
            public object ThemeId { get; set; }

            [DropDownList("Sys_Organizations", "Id", "Department")]
            [DisplayName("所在部门")]
            public object OrganizationId { get; set; }

            [DisplayName("全局")]
            public object Global { get; set; } 
            
            [DisplayName("禁用")]
            public object Disable { get; set; }
        }
    }
}
